package 面向对象;

public class ArrayUtil {
    private ArrayUtil(){}

    public static String printArr(int[] arr) {
        StringBuilder as = new StringBuilder();
        as.append("[");
        for (int i = 0; i < arr.length; i++) {
            if (i == arr.length - 1) {
                as.append(arr[i]);
            } else {
                as.append(arr[i]).append(",");
            }
        }
        as.append("]");
        return as.toString();
    }
    public static double getAerage(double[] arr){
       double sum = 0;
       for(int i = 0 ; i<arr.length ;i++) {
         sum = sum + arr[i];
       }
       return sum / arr.length;
    }
}
